/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkgjeudestrategie;

import java.awt.BasicStroke;
import javax.swing.JComponent;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

/**
 *
 * @author Alex
 */
public class ContourZone extends Zoomable {

    private Terrain terrain;

    public ContourZone(Terrain terrain) {
        this.terrain = terrain;
        setSize(400, 400);

    }

    @Override
    protected void paintComponent(Graphics g) {

        Graphics2D g2d = (Graphics2D) g;
        if (terrain instanceof Territoire) {
            Territoire territoire = (Territoire) terrain;
            if (territoire.isClicked) {
                g2d.setColor(Color.WHITE);
            } else if (territoire.isOccupied && !territoire.isPossessed) {
                g2d.setColor(Color.RED);
            } else if (territoire.isPossessed) {
                g2d.setColor(territoire.getPlayerColor());
            } else {
                g2d.setColor(Color.BLACK);
            }
            g2d.setStroke(new BasicStroke(12));
        g2d.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
            

        }
        else {
            ZoneInfranchissable zoneI = (ZoneInfranchissable) terrain;
            if (zoneI.isClicked()) {
                g2d.setColor(Color.WHITE);
            } else {
                g2d.setColor(Color.BLACK);
            }
            g2d.setStroke(new BasicStroke(12));
            g2d.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
        }

    }
}
